home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Go Sit In The Corner 1.0 / source / cdev code / cdev gui.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.9 KB  |  104 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        cdev gui.c
  4.  
  5. Purpose:    This module handles all the DITL stuff in the cdev --
  6.             checking and unchecking controls, etc.
  7.             
  8.  
  9. Go Sit In The Corner -=- not you, just the cursor
  10. Copyright ©1994, Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "cdev globals.h"
  30. #include "cdev gui.h"
  31. #include "GestaltEQU.h"
  32.  
  33. void CheckShowIcon(DialogPtr theDlog, int numItems, unsigned char showIconQQ)
  34. {
  35.     int                    itemType;
  36.     Handle                itemH;
  37.     Rect                box;
  38.     
  39.     GetDItem(theDlog, kButtonShowIcon+numItems, &itemType, &itemH, &box);
  40.     SetCtlValue((ControlHandle)itemH, showIconQQ ? 1 : 0);
  41. }
  42.  
  43. void CheckOnOff(DialogPtr theDlog, int numItems, Boolean checkOn)
  44. {
  45.     int                    itemType;
  46.     Handle                itemH;
  47.     Rect                box;
  48.     
  49.     GetDItem(theDlog, kButtonOn+numItems, &itemType, &itemH, &box);
  50.     SetCtlValue((ControlHandle)itemH, checkOn ? 1 : 0);
  51.     GetDItem(theDlog, kButtonOff+numItems, &itemType, &itemH, &box);
  52.     SetCtlValue((ControlHandle)itemH, checkOn ? 0 : 1);
  53. }
  54.  
  55. void CheckCorner(DialogPtr theDlog, int numItems, unsigned char whichCorner)
  56. {
  57.     int                    itemType;
  58.     Handle                itemH;
  59.     Rect                box;
  60.     unsigned char        i;
  61.     
  62.     for (i=0x00; i<0x04; i++)
  63.     {
  64.         GetDItem(theDlog, kButtonTopLeft+numItems+i, &itemType, &itemH, &box);
  65.         SetCtlValue((ControlHandle)itemH, (i==whichCorner) ? 1 : 0);
  66.     }
  67. }
  68.  
  69. void CheckTime(DialogPtr theDlog, int numItems, unsigned long theTime)
  70. {
  71.     int                    i;
  72.     Handle                itemH;
  73.     Rect                box;
  74.     int                    itemType;
  75.     int                    index;
  76.     
  77.     switch (theTime)
  78.     {
  79.         case 900:    index=0;    break;
  80.         case 1800:    index=1;    break;
  81.         case 3600:    index=2;    break;
  82.         case 7200:    index=3;    break;
  83.         case 18000:    index=4;    break;
  84.     }
  85.     
  86.     for (i=0; i<5; i++)
  87.     {
  88.         GetDItem(theDlog, kButtonFirstTime+numItems+i, &itemType, &itemH, &box);
  89.         SetCtlValue((ControlHandle)itemH, (i==index) ? 1 : 0);
  90.     }
  91. }
  92.  
  93. void CheckAlways(DialogPtr theDlog, int numItems, unsigned char always)
  94. {
  95.     int                    itemType;
  96.     Handle                itemH;
  97.     Rect                box;
  98.     
  99.     GetDItem(theDlog, kButtonAlways+numItems, &itemType, &itemH, &box);
  100.     SetCtlValue((ControlHandle)itemH, always ? 1 : 0);
  101.     GetDItem(theDlog, kButtonOnlyIf+numItems, &itemType, &itemH, &box);
  102.     SetCtlValue((ControlHandle)itemH, always ? 0 : 1);
  103. }
  104.